package dyyx.jetty;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;

public class HelloAppMain {

	public static Server createServer(int port) {
		Server server = new Server(port);
		WebAppContext webapp = new WebAppContext();
		webapp.setContextPath("/");
		// File warFile = JettyDistribution.resolve("demo-base/webapps/async-rest.war").toFile();
		// webapp.setWar(warFile.getAbsolutePath());
		webapp.setResourceBase("/Users/dugang/work/xdemo/webapp/");
		server.setHandler(webapp);
		return server;
	}

	public static void main(String[] args) throws Exception {
		int port = 8080;
		Server server = createServer(port);
		server.start();
		server.dumpStdErr();
		server.join();
	}

}